Skip to content

Add upload command for sending images/files to Devin sessions#5

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1761689019-add-image-upload-command
Open

Add upload command for sending images/files to Devin sessions#5
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1761689019-add-image-upload-command

Conversation

@devin-ai-integration
Copy link

Add upload command for sending images/files to Devin sessions

Summary

This PR adds a new upload CLI command that allows users to upload images and other files to existing Devin sessions. The implementation follows the existing code patterns and uses the Devin API's /v1/attachments endpoint.

Key changes:

  • Added upload_file_to_attachments() function that uploads files to /v1/attachments endpoint using multipart/form-data
  • Added upload CLI command that takes session_id and --image/-i option
  • Command uploads the file, gets a URL, then sends a message to the session with the attachment formatted as ATTACHMENT:"{url}"
  • Supports both json and table output formats
  • Includes proper error handling for missing files and API errors

Usage:

# Upload an image to a session
devin-cli upload <session_id> --image path/to/image.png

# Upload with an additional message
devin-cli upload <session_id> --image screenshot.png --message "Here's the bug I found"

# Get JSON output
devin-cli upload <session_id> -i data.csv --output json

Review & Testing Checklist for Human

⚠️ Risk Level: Yellow - Code follows documented API patterns but hasn't been tested end-to-end with a real Devin session.

  • Test with a real session: Run devin-cli upload <session_id> --image <test_image> with a valid session ID and verify the attachment appears correctly in the Devin session
  • Verify attachment format: Confirm that the ATTACHMENT:"{url}" format is correctly recognized by Devin (based on API docs, but should be verified)
  • Test error cases: Try with missing file, invalid session ID, and potentially large files to ensure proper error handling
  • Check file limitations: Verify if there are any file size or type restrictions from the API that should be documented or enforced

Test Plan

  1. Create a test Devin session: devin-cli create --prompt "Test session"
  2. Create a simple test image: echo "test" > test.txt (or use any real image)
  3. Upload to session: devin-cli upload <session_id> --image test.txt
  4. Check the Devin session UI to confirm the attachment is visible and accessible
  5. Test with --message option and --output json option

Notes

- Add upload_file_to_attachments() API function that uploads files to /v1/attachments endpoint
- Add upload CLI command that takes session_id and --image/-i option
- Command uploads file and sends message to session with attachment URL
- Follows existing patterns from message command and send_message_to_session()
- Supports both json and table output formats
- Uses multipart/form-data encoding via requests files parameter

Co-Authored-By: parker.duff@codeium.com <pwjduff@gmail.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants

Comments